package com.tiyo.monitor.service.impl;

import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tiyo.monitor.mapper.SysLoginLogMapper;
import com.tiyo.monitor.mapper.domain.SysLoginLog;
import com.tiyo.monitor.service.SysLoginLogService;
@Service
public class SysLoginLogServiceImpl implements SysLoginLogService {
	@Autowired
	SysLoginLogMapper sysLoginLogMapper;
	@Override
	public void insertLoginLog(SysLoginLog logininfor) {
		logininfor.setLoginTime(new Date());
		sysLoginLogMapper.insert(logininfor);

	}
	@Override
	public IPage<SysLoginLog> selectLogininforList(SysLoginLog logininfor) {
		QueryWrapper<SysLoginLog> queryWrapper = new QueryWrapper<SysLoginLog>();
		Page<SysLoginLog> page = new Page<SysLoginLog>(1, 10);
		return sysLoginLogMapper.selectPage(page, queryWrapper);
	}
	@Override
	public void deleteLogininforByIds(String ids) {
		sysLoginLogMapper.deleteBatchIds(Arrays.asList(ids.split(",")));
		
	}
	@Override
	public void cleanLogininfor() {
		Map<String, Object> columnMap = new HashMap<String, Object>();
		sysLoginLogMapper.deleteByMap(columnMap);
	}

}
